﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SoccerEvaluator.Common;

namespace SoccerEvaluator.WebSite
{
    /// <summary>
    /// 
    /// </summary>
    public partial class Registry : System.Web.UI.Page
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void cmdOk_Click(object sender, EventArgs e)
        {
            try
            {
                SystemUserInfo userInfo = new SystemUserInfo();

                userInfo.Name = this.txtName.Text.Trim();
                userInfo.Password = this.txtPassword1.Text.Trim();
                userInfo.Username = this.txtUserName.Text.Trim();
                userInfo.Email = this.txtEmail.Text.Trim();

                Business.User user = new Business.User();

                user.Add(userInfo);

                ClientScript.RegisterStartupScript(typeof(string), "Close", "Close();", true);
            }
            catch
            {
                string script = string.Format("alert('{0}')", "Error al registrar el usuario");

                ClientScript.RegisterStartupScript(typeof(string), "Error", script, true);
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button2_Click(object sender, EventArgs e)
        {
            ClientScript.RegisterStartupScript(typeof(string), "Close", "Close();", true);
        }
    }
}